package model;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import org.apache.struts.action.ActionMessage;

public class ProductBean implements java.io.Serializable {
	private int id = 0;
	private String name = "";
	private double price = 0;
	private java.util.Date make = null;
	private int expire = 0;
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");

	public int getId() {
		return id;
	}

	public void setId(String id) {
		if (id != null && id.length() != 0) {
			try {
				this.id=Integer.parseInt(id);
			} catch (NumberFormatException e) {
				e.printStackTrace();
			}
		}
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(String price) {
		if (price != null && price.length() != 0) {
			try {
				this.price = Double.parseDouble(price);
			} catch (NumberFormatException e) {
				e.printStackTrace();
			}
		}
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public java.util.Date getMake() {
		return make;
	}

	public void setMake(String make) {
		if (make != null && make.length() != 0) {
			try {
				this.make = sdf.parse(make);
			} catch (ParseException e) {
				e.printStackTrace();
			}

		}
	}

	public void setMake(java.util.Date make) {
		this.make = make;
	}

	public int getExpire() {
		return expire;
	}

	public void setExpire(String expire) {
		if (expire != null && expire.length() != 0) {
			try {
				this.expire = Integer.parseInt(expire);
			} catch (NumberFormatException e) {
				e.printStackTrace();
			}

		}
	}

	public void setExpire(int expire) {
		this.expire = expire;
	}
}
